<?php
class Globals
{
	public function connect(&$objDb)
	{	
		$objConf 	= new Zend_Config_Ini(ROOT_DIR . '/configs/config.ini', 'db');
		$arrConf 	= $objConf->db->toArray() + array('driver_options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;'));
		$objDb 		= Zend_Db::factory($arrConf['adapter'], $arrConf['config']);
		Zend_Registry::set('objDb', $objDb);
	}		
	public function uploadProduct($file)
	{
		if ($file['name'] != '') {
			$strFullFolder 		= DIR_PRODUCT;
			$arrUploadResult 	= Vfriend_Upload::process($file, $strFullFolder, 3*1024*1024);	
			$strFullPath		= $arrUploadResult['fullpath'];
			Vfriend_Crop::thumbSquare($strFullPath, $strFullPath);		
			return $arrUploadResult;
		}
		return null;
	}	
}
?>